#pragma once

#include "API.h"
#include "Board.h"

namespace snake
{

/**
 * Simple coder-decoder of Board object to/from string.
 * Board must be square (width equals height).
 *
 * Each cell of the board is encoded with a symbol:
 *  wall (-, |, +)
 *  snake head looking right (>)
 *  snake head looking left (<)
 *  snake head looking up (^)
 *  snake head looking down (v)
 *  snake body (o)
 *  food (!)
 *  poo (?)
 *  empty cell (space)
 *
 * 5x5 example:
 * +---+
 * | ?!|
 * |o  |
 * |oo>|
 * +---+
 */
class SNAKE_API BoardCodec
  {
  public:
    /// Decodes Board object from the given string, all wall symbols processed the same way
    Board FromString(const std::string &code) const;

    /// Encodes Board into string, only one wall symbol is used
    std::string ToString(const Board &board) const;
  };

}